﻿using Autofac;
using GC_FFW.SoccerfameParser.Abstractions.Helpers.Validators;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Builders;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Factories;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Helpers;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Services;
using GC_FFW.SoccerfameParser.Abstractions.Managers;
using GC_FFW.SoccerfameParser.Builders;
using GC_FFW.SoccerfameParser.Factories;
using GC_FFW.SoccerfameParser.Helpers;
using GC_FFW.SoccerfameParser.Helpers.Validators;
using GC_FFW.SoccerfameParser.Managers;
using GC_FFW.SoccerfameParser.Services;

namespace GC_FFW.SoccerfameParser.Modules.Autofac
{
	public class SoccerfameParserModule : Module
	{
		#region Override Methods

		protected override void Load(ContainerBuilder builder)
		{
			base.Load(builder);

			//Dependencies: IXmlSerializerService
			builder.RegisterType<RepositoryFactory>().As<IRepositoryFactory>().SingleInstance();

			//Dependencies: IApplicationConfiguration, IRepositoryFactory
			builder.RegisterType<SoccerfameDataHelperFactory>().As<ISoccerfameDataHelperFactory>().SingleInstance();

			builder.RegisterType<StringManager>().As<IStringManager>().SingleInstance();

			builder.RegisterType<UrlValidator>().As<UrlBaseValidator>().SingleInstance();

			//Dependencies: UrlBaseValidator
			builder.RegisterType<WebPageManager>().As<WebPageBaseManager>().SingleInstance();

			//Dependencies: WebPageBaseManager, IStringManager
			builder.RegisterType<HtmlDocumentManager>().As<HtmlDocumentBaseManager>().SingleInstance();

			//Dependencies: HtmlDocumentBaseManager, ISoccerfameDataHelperFactory
			builder.RegisterType<AdapterFactory>().As<IAdapterFactory>().SingleInstance();

			//Dependencies: IAdapterFactory
			builder.RegisterType<ForecastDataBuilder>().As<IForecastDataBuilder>().SingleInstance();

			//Dependencies: ISoccerfameDataHelperFactory
			builder.RegisterType<ImportService>().As<IImportService>().SingleInstance();
		}

		#endregion
	}
}
